package sw6.visualschedule.extendedViews;

import android.content.Context;
import android.util.AttributeSet;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.widget.Gallery;

public class StepGallery extends Gallery {

	public static final int NEXT_STEP = KeyEvent.getMaxKeyCode() + 1;
	
	/**
	 * Constructs a step gallery.
	 * @param context the context to run in.
	 */
	public StepGallery(final Context context) {
		super(context);
	}
	
	/**
     * Constructs a step gallery.
     * @param context the context to run in.
     */
	public StepGallery(final Context context, final AttributeSet attrs) {
		super(context, attrs);
	}
	
	/**
     * Constructs a step gallery.
     * @param context the context to run in.
     */
	public StepGallery(final Context context, final AttributeSet attrs, final int defStyle) {
		super(context, attrs, defStyle);
	}

	@Override
	public boolean onFling(final MotionEvent event1, final MotionEvent event2, final float velocityX, final float velocityY) {
		return true;
	}
	
	@Override
	public boolean onScroll(final MotionEvent event1, final MotionEvent event2, final float distanceX, final float distanceY) {
		return true;
	}
	
	@Override
	public boolean onTouchEvent(final MotionEvent event) {
		return false;
	}
	
	@Override
	public boolean onKeyDown(final int keyCode, final KeyEvent event) {
	    boolean result = true;
	    
		if (keyCode == NEXT_STEP) {
			result = super.onKeyDown(KeyEvent.KEYCODE_DPAD_RIGHT, event);
		}
		
		return result;
	}
}
